package com.zhangwei.touch.widget;

import android.content.Context;
import android.support.v4.view.ViewPager;
import android.util.AttributeSet;
import android.view.MotionEvent;

/**
 * @author zhangwei
 * @version V1.0
 * @Title: Advanced
 * @Package com.zhangwei.touch.widget
 * @Description:
 * @date 15/10/21 下午5:02
 */

public class MyViewPage extends ViewPager {
    public MyViewPage(Context context) {
        super(context);
    }

    public MyViewPage(Context context, AttributeSet attrs) {
        super(context, attrs);
    }


    @Override
    public boolean onTouchEvent(MotionEvent ev) {
//        int downX = (int) ev.getX();
//        int downY = (int) ev.getY();
//        switch (ev.getAction()) {
//            case MotionEvent.ACTION_DOWN:
//                break;
//            case MotionEvent.ACTION_MOVE:
//                break;
//            case MotionEvent.ACTION_UP:
//                int upX = (int) ev.getX();
//                int upY = (int) ev.getY();
//                if (Math.abs(upY - downY) < Math.abs(upX - downX)) {
//                    //通知父类不要处理子类的方法
//
//                }
//                break;
//        }
        getParent().requestDisallowInterceptTouchEvent(true);
        return super.onTouchEvent(ev);
    }
}
